package com.changgou.listener;

import com.changgou.service.EsManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 商品添加索引库消息监听类
 */
@Component
public class GoodsUpListener {

    @Autowired
    private EsManagerService esManagerService;

    @RabbitListener(queues = "search_add_queue")
    public void searchAdd(String spuId){
        System.out.println("接收到消息："+spuId);
        esManagerService.importDataToESBySpuId(spuId);
    }

    @RabbitListener(queues = "search_down_queue")
    public void searchDown(String spuId){
        System.out.println("接收到消息："+spuId);
        esManagerService.delDataToESBySpuId(spuId);
    }
}
